-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(compiler)!: Remove Exclusive/Inclusive Ranges, provide as record via compiler #1616
Conversation
I think if Also, thoughts on adding unbounded ranges like |
1a385a7
to
e2b0528
Compare
I've updated this PR to turn |
Should the casing of the record fields be changed to camelcase to match the rest of the language? |
Probably, but I hate it. 🤣 |
What about just |
We discussed |
Thoughts on |
I like the idea. I suppose I need to go back and get that implementation 😛 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome!
* @since v0.6.0 | ||
* @history v0.3.0: Root APIs originally handled Inclusive & Exclusive variants | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the docs touch the implementations or is this a formatter bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatter bug. We're not blocking on it though. Hopefully it'll be fixed soon.
Co-authored-by: Oscar Spencer <oscar@grain-lang.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
… via compiler (grain-lang#1616) * feat(compiler)!: Remove Exclusive/Inclusive Ranges, provide as record via compiler * update snapshots * update docs * formatting * rename range_start and range_end * remove old idents * feat(stdlib): Add Inclusive submodule to Range module * Update compiler/src/typed/builtin_types.re Co-authored-by: Oscar Spencer <oscar@grain-lang.org> * formatting --------- Co-authored-by: Oscar Spencer <oscar@grain-lang.org>
Closes #1404
This adds the Range enum as a language-supplied type, which is a prerequisite to having language syntax for ranges.
The new Range is a
record Range<a> { rangeStart: a, rangeEnd: a }
. It is now up to APIs to decide if the range is interpreted as Inclusive or Exclusive, and is no longer limited to only Numbers, which also allow APIs to decide how to interpret the types.